//Analyses for Final Version of Paper (variables generated as described in Appendix A of the Supplemental Material)
set scheme lean1
*Creating Figure 1: Scatterplots and correlations*
//Overall analysis of corr between parent and child attitudes, no division
heatplot cissue pissue if _j==2, ylabel(0 "SD" 1 "SR", nogrid) ytitle("") xtitle("") xlabel(0 "SD" 1 "SR", nogrid) levels(16) keylabels(minmax, format(%4.0g)) colors(gs15 gs14 gs13 gs12 gs11 gs10 gs9 gs8 gs7 gs6 gs5 gs4 gs3 gs2 gs1 gs0) addplot(lfit cissue pissue if _j==2, color(gs0)) legend(subtitle("% N")) title("Partisanship") aspectratio(1) saving(Figure1_OverallPID.gph, replace)

heatplot cissue pissue if issue>0, ylabel(0 "Lib" 1 "Cons", nogrid) ytitle("") xtitle("")  xlabel(0 "Lib" 1 "Cons", nogrid) keylabels(minmax, format(%6.0g)) levels(16) colors(gs15 gs14 gs13 gs12 gs11 gs10 gs9 gs8 gs7 gs6 gs5 gs4 gs3 gs2 gs1 gs0) addplot(lfit cissue pissue if issue>0, color(gs0)) legend(subtitle("% N")) title("Issue Attitudes") aspectratio(1)  saving(Figure1_OverallISS.gph, replace)

corr cissue pissue if _j == 2
corr cissue pissue if issue>0

graph combine "Figure1_OverallPID.gph" "Figure1_OverallISS.gph", title("All Families") saving(Figure1_OverallPanel.gph, replace)

///Overall analysis of corr between parent and child attitudes divided into low and high constraint
heatplot cissue pissue if _j==2, ylabel(0 "SD" 1 "SR", nogrid) ytitle("") xtitle("")  xlabel(0 "SD" 1 "SR", nogrid) levels(16) keylabels(minmax, format(%4.0g)) colors(gs15 gs14 gs13 gs12 gs11 gs10 gs9 gs8 gs7 gs6 gs5 gs4 gs3 gs2 gs1 gs0) addplot((lfit cissue pissue if _j==2 & noSPconstraint_01 <= 0,  lpattern(shortdash) color(gs0)) (lfit cissue pissue if _j==2 & noSPconstraint_01 >= .7142857, lpattern(longdash) color(gs0))) legend(subtitle("% N")) title("Partisanship") aspectratio(1) saving(Figure1_HLConstraintPID.gph, replace)

heatplot cissue pissue if issue>0, ylabel(0 "Lib" 1 "Cons", nogrid) ytitle("") xtitle("")  xlabel(0 "Lib" 1 "Cons", nogrid) keylabels(minmax, format(%6.0g)) levels(16) colors(gs15 gs14 gs13 gs12 gs11 gs10 gs9 gs8 gs7 gs6 gs5 gs4 gs3 gs2 gs1 gs0) addplot((lfit cissue pissue if issue>0 & noSPconstraint_01 <= 0, lpattern(shortdash) color(gs0)) (lfit cissue pissue if issue>0 & noSPconstraint_01 >= .7142857, lpattern(longdash) color(gs0))) title("Issue Attitudes") legend(subtitle("% N")) aspectratio(1) saving(Figure1_HLConstraintISS.gph, replace)

corr cissue pissue if _j == 2 & noSPconstraint_01 <= 0
corr cissue pissue if _j == 2 & noSPconstraint_01 >= .7142857

corr cissue pissue if issue>0 & noSPconstraint_01 <= 0
corr cissue pissue if issue>0 & noSPconstraint_01 >= .7142857

graph combine "Figure1_HLConstraintPID.gph" "Figure1_HLConstraintISS.gph", title("All Families") saving(Figure1_LowHighConstraintPanel.gph, replace)

//Parent and Child attitudes in Low Engagement Homes
heatplot cissue pissue if _j==2 & jsbpscaled1 <= .1666667, ylabel(0 "SD" 1 "SR", nogrid) ytitle("") xtitle("")  xlabel(0 "SD" 1 "SR", nogrid) levels(16) keylabels(minmax, format(%4.0g)) colors(gs15 gs14 gs13 gs12 gs11 gs10 gs9 gs8 gs7 gs6 gs5 gs4 gs3 gs2 gs1 gs0) addplot((lfit cissue pissue if _j==2 & noSPconstraint_01 <= 0 & jsbpscaled1 <= .1666667, lpattern(shortdash) color(gs0)) (lfit cissue pissue if _j==2 & noSPconstraint_01 >= .7142857 & jsbpscaled1 <= .1666667, aspectratio(1) lpattern(longdash) color(gs0))) legend(subtitle("% N")) title("Partisanship") saving(Figure1_LowEngPID.gph, replace)

heatplot cissue pissue if issue>0 & jsbpscaled1 <= .1666667, ylabel(0 "Lib" 1 "Cons", nogrid) ytitle("") xtitle("")  xlabel(0 "Lib" 1 "Cons", nogrid) keylabels(minmax, format(%6.0g)) levels(16) colors(gs15 gs14 gs13 gs12 gs11 gs10 gs9 gs8 gs7 gs6 gs5 gs4 gs3 gs2 gs1 gs0) addplot((lfit cissue pissue if issue>0 & noSPconstraint_01 <= 0 & jsbpscaled1 <= .1666667, lpattern(shortdash) color(gs0)) (lfit cissue pissue if issue>0 & noSPconstraint_01 >= .7142857 & jsbpscaled1 <= .1666667, aspectratio(1) lpattern(longdash) color(gs0))) legend(subtitle("% N")) title("Issue Attitudes") saving(Figure1_LowEngISS.gph, replace)

graph combine "Figure1_LowEngPID.gph" "Figure1_LowEngISS.gph", title("Low Politicization Homes") saving(Figure1_LowEngagement.gph, replace)

corr cissue pissue if _j == 2 & noSPconstraint_01 <= 0 & jsbpscaled1 <= .1666667
corr cissue pissue if _j == 2 & noSPconstraint_01 >= .7142857 & jsbpscaled1 <= .1666667
corr cissue pissue if issue>0 & noSPconstraint_01 <= 0 & jsbpscaled1 <= .1666667
corr cissue pissue if issue>0 & noSPconstraint_01 >= .7142857 & jsbpscaled1 <= .1666667

//Parent and Child Attitutdes in High Engagement Homes
heatplot cissue pissue if _j==2 & jsbpscaled1 >= .8333333, ylabel(0 "SD" 1 "SR", nogrid) ytitle("") xtitle("") xlabel(0 "SD" 1 "SR", nogrid) levels(16) keylabels(minmax, format(%4.0g)) colors(gs15 gs14 gs13 gs12 gs11 gs10 gs9 gs8 gs7 gs6 gs5 gs4 gs3 gs2 gs1 gs0) addplot((lfit cissue pissue if _j==2 & noSPconstraint_01 <= 0 & jsbpscaled1 >= .8333333, title("Low Constraint") lpattern(shortdash) color(gs0)) (lfit cissue pissue if _j==2 & noSPconstraint_01 >= .7142857 & jsbpscaled1 >= .8333333, lpattern(longdash) aspectratio(1) color(gs0))) legend(subtitle("% N")) title("Partisanship") saving(Figure1_HighEngPID.gph, replace)

heatplot cissue pissue if issue>0 & jsbpscaled1 >= .8333333, ylabel(0 "Lib" 1 "Cons", nogrid) ytitle("") xtitle("") xlabel(0 "Lib" 1 "Cons", nogrid) keylabels(minmax, format(%6.0g)) levels(16) colors(gs15 gs14 gs13 gs12 gs11 gs10 gs9 gs8 gs7 gs6 gs5 gs4 gs3 gs2 gs1 gs0) addplot((lfit cissue pissue if issue>0 & noSPconstraint_01 <= 0 & jsbpscaled1 >= .8333333, lpattern(shortdash) color(gs0)) (lfit cissue pissue if issue>0 & noSPconstraint_01 >= .7142857 & jsbpscaled1 >= .8333333, aspectratio(1) lpattern(longdash) color(gs0))) legend(subtitle("% N")) title("Issue Attitudes") saving(Figure1_HighEngISS.gph, replace)

graph combine "Figure1_HighEngPID.gph" "Figure1_HighEngISS.gph", title("High Politicization Homes") saving(Figure1_HighEngagement.gph, replace)


corr cissue pissue if _j == 2 & noSPconstraint_01 <= 0 & jsbpscaled1 >= .8333333
corr cissue pissue if _j == 2 & noSPconstraint_01 >= .7142857 & jsbpscaled1 >= .8333333

corr cissue pissue if issue>0 & noSPconstraint_01 <= 0 & jsbpscaled1 >= .8333333
corr cissue pissue if issue>0 & noSPconstraint_01 >= .7142857 & jsbpscaled1 >= .8333333


graph combine "Figure1_OverallPanel.gph" "Figure1_LowHighConstraintPanel.gph" "Figure1_HighEngagement.gph" "Figure1_LowEngagement.gph", title("Relationship of Parent and Child Attitudes") subtitle("By Family Type and Parent Constraint") col(1) xsize(1) ysize(2) saving(Figure1.gph, replace)

*Creating Figures 2 and 3; Main Models*
////Hypothesis 1////
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
eststo h1pidall
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") aspectratio(1) saving(AllGens_H1_PID.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857)) asobserved pwcompare(effect)
//No difference

//Issue Attitudes
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
eststo h1issall
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") aspectratio(1) saving(AllGens_H1_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857)) asobserved pwcompare(effect)

graph combine "AllGens_H1_PID.gph" "AllGens_H1_Iss.gph", rows(1) ycommon commonscheme title("Estimated Effects of Parent’s Political Views on Child’s") subtitle("As Moderated by Parental Ideological Constraint") saving(Allgens_H1_Figure2.gph, replace)


////HYPOTHESIS 2////
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
eststo h2pidall
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p90)jsbpscaled1) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(AllGens_H2HP_PID.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p10)jsbpscaled1) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint")  yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(AllGens_H2LP_PID.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled1=(.1666667 .75)) asobserved pwcompare(effect)

//Issue Attitudes
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
eststo h2issall
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p90)jsbpscaled) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(AllGens_H2HP_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p10)jsbpscaled) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(AllGens_H2LP_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled=(.1666667 .75)) asobserved pwcompare(effect)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled=(.1666667 .75)) asobserved coefleg post
test (_b[4._at] - _b[2._at]) = (_b[3._at] - _b[1bn._at])

graph combine "AllGens_H2LP_PID.gph" "AllGens_H2LP_Iss.gph", rows(1) ycommon commonscheme title("Low Politicization Households") saving(Allgens_H2LP_Figure3.gph, replace)

graph combine "AllGens_H2HP_PID.gph" "AllGens_H2HP_Iss.gph", rows(1) ycommon commonscheme title("High Politicization Households") saving(Allgens_H2HP_Figure3.gph, replace)

graph combine "Allgens_H2HP_Figure3.gph" "Allgens_H2LP_Figure3.gph", col(1) ycommon commonscheme title("Estimated Effects of Parent’s Political Views on Child’s") subtitle("As Moderated by Parental Ideological Constraint and Household Politicization") xsize(1) ysize(1.25) saving(Allgens_H2_Figure3.gph, replace)


*Appendix B
esttab h1pidall h1issall using "H1_ALL.rtf", b(3) se(3)
esttab h2pidall h2issall using "H2_ALL.rtf", b(3) se(3)

*Appendix C //1973 and 1997 Results
////Hypothesis 1 1973////
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2 & indicator==0, mle
eststo h1pidall73

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1973_H1_PID.gph, replace)
margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857)) asobserved pwcompare(effect)

//Issue Attitudes
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: if issue==1 & indicator == 0, mle
eststo h1issall73

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1973_H1_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857)) asobserved pwcompare(effect)

graph combine "1973_H1_PID.gph" "1973_H1_Iss.gph", rows(1) ycommon commonscheme title("1973") saving(1973_H1_FigureC1.gph, replace)


///HYPOTHESIS 2 1973//
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: if _j==2 & indicator == 0, mle
eststo h2pidall73
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p90)jsbpscaled1) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1973_H2HP_PID.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p10)jsbpscaled1) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint")  yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1973_H2LP_PID.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled1=(.1666667 .75)) asobserved pwcompare(effect)

//Issue Attitudes
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue==1 & indicator == 0, mle
eststo h2issall73
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p90)jsbpscaled) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1973_H2HP_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p10)jsbpscaled) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1973_H2LP_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled=(.1666667 .75)) asobserved pwcompare(effect)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled=(.1666667 .75)) asobserved coefleg post
test (_b[4._at] - _b[2._at]) = (_b[3._at] - _b[1bn._at])


graph combine "1973_H2LP_PID.gph" "1973_H2LP_Iss.gph", rows(1) ycommon commonscheme title("Low Politicization Households") saving(1973_H2LP_FigureC2.gph, replace)

graph combine "1973_H2HP_PID.gph" "1973_H2HP_Iss.gph", rows(1) ycommon commonscheme title("High Politicization Households") saving(1973_H2HP_FigureC2.gph, replace)

graph combine "1973_H2HP_FigureC2.gph" "1973_H2LP_FigureC2.gph", col(1) ycommon commonscheme xsize(1) ysize(1.25) title("1973") saving(1973_H2_FigureC2.gph, replace)



////Hypothesis 1 1997////
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2 & indicator==1, mle
eststo h1pidall97

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1997_H1_PID.gph, replace)
margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857)) asobserved pwcompare(effect)

//Issue Attitudes
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: if issue==1 & indicator == 1, mle
eststo h1issall97

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1997_H1_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857)) asobserved pwcompare(effect)

graph combine "1997_H1_PID.gph" "1997_H1_Iss.gph", rows(1) ycommon commonscheme title("1997") saving(1997_H1_FigureC3.gph, replace)

///HYPOTHESIS 2 1997//
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: if _j==2 & indicator == 1, mle
eststo h2pidall97
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p90)jsbpscaled1) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1997_H2HP_PID.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p10)jsbpscaled1) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint")  yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1997_H2LP_PID.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled1=(.1666667 .75)) asobserved pwcompare(effect)

//Issue Attitudes
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue==1 & indicator == 1, mle
eststo h2issall97

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p90)jsbpscaled) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1997_H2HP_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p10)jsbpscaled) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") saving(1997_H2LP_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled1=(.1666667 .75)) asobserved pwcompare(effect)

margins, dydx(pissue) at(noSPconstraint_01=(0 .7142857) jsbpscaled1=(.1666667 .75)) asobserved coefleg post
test (_b[4._at] - _b[2._at]) = (_b[3._at] - _b[1bn._at])

graph combine "1997_H2LP_PID.gph" "1997_H2LP_Iss.gph", rows(1) ycommon commonscheme title("Low Politicization Households") saving(1997_H2LP_FigureC3.gph, replace)

graph combine "1997_H2HP_PID.gph" "1997_H2HP_Iss.gph", rows(1) ycommon commonscheme title("High Politicization Households") saving(1997_H2HP_FigureC3.gph, replace)

graph combine "1997_H2HP_FigureC3.gph" "1997_H2LP_Figurec3.gph", col(1) ycommon commonscheme title("1997") xsize(1) ysize(1.25) saving(1997_H2_FigureC2.gph, replace)

//Combining for Final Graphs
graph combine "1973_H1_FigureC1.gph" "1997_H1_FigureC3.gph", col(1) ycommon commonscheme  title("Estimated Effects of Parent's Political Views on Child's") subtitle("As Moderated by Parental Ideological Constraint") xsize(1) ysize(1.25) saving(7397_H1_FigureC2.gph, replace)

graph combine "1973_H2_FigureC2.gph" "1997_H2_FigureC2.gph", col(1) ycommon commonscheme title("Estimated Effects of Parent's Political Views on Child's") subtitle("As Moderated by Parental Ideological Constraint and Household Politicization") xsize(1) ysize(2) saving(FigureC4(H2).gph, replace)

//Investigating distribution of moderate answers
bysort indicator: tab noSPconstraint moderatecountSPnew

bysort indicator: sum moderatecountSPnew if issue>0 & noSPconstraint <= 0
bysort indicator: sum moderatecountSPnew if issue>0 & noSPconstraint >= 5

bysort indicator: tab noSPconstraint 

*Appendix D - Models without Controls
//Showing Models without Controls
//H1
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 || region: || V7: || V5002: || indicator: if _j==2, mle

//Issue
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle

//H2
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 || region: || V7: || V5002: || indicator: if _j==2, mle

//Issues
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle

*Appendix E
gen moderatecountSPnew = (p_aidminora0 + p_stdlivingnewa0 + p_libconsnewa0 + p_busing2a0 + p_marijuanaa0 + p_rightsaccused1a0 + p_womensrights1a0)
reg noSPconstraint moderatecountSPnew
predict noSPresidualsnew, residuals

foreach v of var noSPresidualsnew { 
su `v', meanonly 
gen new_`v' = (`v' - r(min))/(r(max) - r(min)) 
}

rename new_noSPresidualsnew noSPresidualsnew_01
//Hypothesis 1
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
xtmixed cissue c.pissue##c.noSPresidualsnew_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle

//Issue
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
xtmixed cissue c.pissue##c.noSPresidualsnew_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle

//Hypothesis 2
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
xtmixed cissue c.pissue##c.noSPresidualsnew_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle

//Issue
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
xtmixed cissue c.pissue##c.noSPresidualsnew_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle


*Appendix F
gen p_rightsaccused1adk = .
replace p_rightsaccused1adk = -1 if P_V363 == 1
replace p_rightsaccused1adk = -1 if P_V363 == 2
replace p_rightsaccused1adk = -1 if P_V363 == 3
replace p_rightsaccused1adk = 0 if P_V363 == 4
replace p_rightsaccused1adk = 1 if P_V363 == 5
replace p_rightsaccused1adk = 1 if P_V363 == 6
replace p_rightsaccused1adk = 1 if P_V363 == 7
replace p_rightsaccused1adk = . if P_V363 == 8 //dk
replace p_rightsaccused1adk = 0 if P_V363 == 0
replace p_rightsaccused1adk = . if P_V363 == 9
replace p_rightsaccused1adk = -1 if V5251 == 1
replace p_rightsaccused1adk = -1 if V5251 == 2
replace p_rightsaccused1adk = -1 if V5251 == 3
replace p_rightsaccused1adk = 0 if V5251 == 4
replace p_rightsaccused1adk = 1 if V5251 == 5
replace p_rightsaccused1adk = 1 if V5251 == 6
replace p_rightsaccused1adk = 1 if V5251 == 7
replace p_rightsaccused1adk = 0 if V5251 == 96
replace p_rightsaccused1adk = . if V5251 == 98 //dk
replace p_rightsaccused1adk = . if V5251 == 99

gen p_womensrights1adk = .
replace p_womensrights1adk = 1 if P_V392 == 7
replace p_womensrights1adk = 1 if P_V392 == 6
replace p_womensrights1adk = 1 if P_V392 == 5
replace p_womensrights1adk = 0 if P_V392 == 4
replace p_womensrights1adk = -1 if P_V392 == 3
replace p_womensrights1adk = -1 if P_V392 == 2
replace p_womensrights1adk = -1 if P_V392 == 1
replace p_womensrights1adk = . if P_V392 == 8 //dk
replace p_womensrights1adk = 0 if P_V392 == 0
replace p_womensrights1adk = . if P_V392 == 9
replace p_womensrights1adk = 0 if V5254 == 4
replace p_womensrights1adk = 1 if V5254 == 7
replace p_womensrights1adk = 1 if V5254 == 5
replace p_womensrights1adk = 1 if V5254 == 6
replace p_womensrights1adk = -1 if V5254 == 1
replace p_womensrights1adk = -1 if V5254 == 2
replace p_womensrights1adk = -1 if V5254 == 3
replace p_womensrights1adk = 0 if V5254 == 96
replace p_womensrights1adk = . if V5254 == 98 //dk
replace p_womensrights1adk = . if V5254 == 99

gen p_busing2adk = .
replace p_busing2adk = -1 if P_V417 == 1
replace p_busing2adk = 0 if P_V417 == 3
replace p_busing2adk = 0 if P_V417 == 0
replace p_busing2adk = . if P_V417 == 8 //dk
replace p_busing2adk = 1 if P_V417 == 5
replace p_busing2adk = -1 if V5314 == 1
replace p_busing2adk = 0 if V5314 == 2
replace p_busing2adk = 0 if V5314 == 3
replace p_busing2adk = 1 if V5314 == 4
replace p_busing2adk = 1 if V5314 == 5
replace p_busing2adk = . if V5314 == 7
replace p_busing2adk = . if V5314 == 8 // dk
replace p_busing2adk = . if V5314 == 9
replace p_busing2adk = 0 if V5313 == 5
replace p_busing2adk = . if V5313 == 9

gen p_libconsnewadk = .
replace p_libconsnewadk = 1 if V5300 == 5
replace p_libconsnewadk = 1 if V5300 == 6
replace p_libconsnewadk = 1 if V5300 == 7
replace p_libconsnewadk = -1 if V5300 == 1
replace p_libconsnewadk = -1 if V5300 == 2
replace p_libconsnewadk = -1 if V5300 == 3
replace p_libconsnewadk = 0 if V5300 == 4
replace p_libconsnewadk = 4 if V5300 == 96
replace p_libconsnewadk = 1 if P_V408 == 5
replace p_libconsnewadk = 1 if P_V408 == 6
replace p_libconsnewadk = 1 if P_V408 == 7
replace p_libconsnewadk = -1 if P_V408 == 1
replace p_libconsnewadk = -1 if P_V408 == 2
replace p_libconsnewadk = -1 if P_V408 == 3
replace p_libconsnewadk = 0 if P_V408 == 4
replace p_libconsnewadk = 0 if P_V408 == 0
replace p_libconsnewadk = . if P_V408 == 9
replace p_libconsnewadk = . if P_V408 == 8 //dk

gen p_stdlivingnewadk = .
replace p_stdlivingnewadk = 1 if V5250 == 5
replace p_stdlivingnewadk = 1 if V5250 == 6
replace p_stdlivingnewadk = 1 if V5250 == 7
replace p_stdlivingnewadk = -1 if V5250 == 1
replace p_stdlivingnewadk = -1 if V5250 == 2
replace p_stdlivingnewadk = -1 if V5250 == 3
replace p_stdlivingnewadk = 0 if V5250 == 4
replace p_stdlivingnewadk = 4 if V5250 == 96
replace p_stdlivingnewadk = 1 if P_V356 == 5
replace p_stdlivingnewadk = 1 if P_V356 == 6
replace p_stdlivingnewadk = 1 if P_V356 == 7
replace p_stdlivingnewadk = -1 if P_V356 == 1
replace p_stdlivingnewadk = -1 if P_V356 == 2
replace p_stdlivingnewadk = -1 if P_V356 == 3
replace p_stdlivingnewadk = 0 if P_V356 == 4
replace p_stdlivingnewadk = 0 if P_V356 == 0
replace p_stdlivingnewadk = . if P_V356 == 9
replace p_stdlivingnewadk = . if P_V356 == 8 //dk


gen p_marijuanaadk = .
replace p_marijuanaadk = 1 if P_V379 == 7
replace p_marijuanaadk = 1 if P_V379 == 6
replace p_marijuanaadk = 1 if P_V379 == 5
replace p_marijuanaadk = 0 if P_V379 == 4
replace p_marijuanaadk = -1 if P_V379 == 3
replace p_marijuanaadk = -1 if P_V379 == 2
replace p_marijuanaadk = -1 if P_V379 == 1
replace p_marijuanaadk = 0 if P_V379 == 0
replace p_marijuanaadk = . if P_V379 == 8
replace p_marijuanaadk = . if P_V379 == 9
replace p_marijuanaadk = 1 if V5253 == 7
replace p_marijuanaadk = 1 if V5253 == 6
replace p_marijuanaadk = 1 if V5253 == 5
replace p_marijuanaadk = 0 if V5253 == 4
replace p_marijuanaadk = -1 if V5253 == 3
replace p_marijuanaadk = -1 if V5253 == 2
replace p_marijuanaadk = -1 if V5253 == 1
replace p_marijuanaadk = 0 if V5253 == 96
replace p_marijuanaadk = . if V5253 == 98 //dk

gen p_aidminoradk = .
replace p_aidminoradk = 1 if V5252 == 5
replace p_aidminoradk = 1 if V5252 == 6
replace p_aidminoradk = 1 if V5252 == 7
replace p_aidminoradk = 0 if V5252 == 4
replace p_aidminoradk = -1 if V5252 == 1
replace p_aidminoradk = -1 if V5252 == 2
replace p_aidminoradk = -1 if V5252 == 3
replace p_aidminoradk = . if V5252 == 98 //dk
replace p_aidminoradk = 0 if V5252 == 96
replace p_aidminoradk = 1 if P_V371 == 5
replace p_aidminoradk = 1 if P_V371 == 6
replace p_aidminoradk = 1 if P_V371 == 7
replace p_aidminoradk = -1 if P_V371 == 1
replace p_aidminoradk = -1 if P_V371 == 2
replace p_aidminoradk = -1 if P_V371 == 3
replace p_aidminoradk = 0 if P_V371 == 4
replace p_aidminoradk = . if P_V371 == 8 //dk
replace p_aidminoradk = 0 if P_V371 == 0
replace p_aidminoradk = . if P_V371 == 9

//Creating Liberal-Conservative Scale Variables, using issues constant across years with new dk and htmat excluded
gen p_rightsaccused1adkhtmat = .
replace p_rightsaccused1adkhtmat = -1 if P_V363 == 1
replace p_rightsaccused1adkhtmat = -1 if P_V363 == 2
replace p_rightsaccused1adkhtmat = -1 if P_V363 == 3
replace p_rightsaccused1adkhtmat = 0 if P_V363 == 4
replace p_rightsaccused1adkhtmat = 1 if P_V363 == 5
replace p_rightsaccused1adkhtmat = 1 if P_V363 == 6
replace p_rightsaccused1adkhtmat = 1 if P_V363 == 7
replace p_rightsaccused1adkhtmat = . if P_V363 == 8 //dk
replace p_rightsaccused1adkhtmat = . if P_V363 == 0 //htmat
replace p_rightsaccused1adkhtmat = . if P_V363 == 9
replace p_rightsaccused1adkhtmat = -1 if V5251 == 1
replace p_rightsaccused1adkhtmat = -1 if V5251 == 2
replace p_rightsaccused1adkhtmat = -1 if V5251 == 3
replace p_rightsaccused1adkhtmat = 0 if V5251 == 4
replace p_rightsaccused1adkhtmat = 1 if V5251 == 5
replace p_rightsaccused1adkhtmat = 1 if V5251 == 6
replace p_rightsaccused1adkhtmat = 1 if V5251 == 7
replace p_rightsaccused1adkhtmat = . if V5251 == 96 //htmat
replace p_rightsaccused1adkhtmat = . if V5251 == 98 //dk
replace p_rightsaccused1adkhtmat = . if V5251 == 99

gen p_womensrights1adkhtmat = .
replace p_womensrights1adkhtmat = 1 if P_V392 == 7
replace p_womensrights1adkhtmat = 1 if P_V392 == 6
replace p_womensrights1adkhtmat = 1 if P_V392 == 5
replace p_womensrights1adkhtmat = 0 if P_V392 == 4
replace p_womensrights1adkhtmat = -1 if P_V392 == 3
replace p_womensrights1adkhtmat = -1 if P_V392 == 2
replace p_womensrights1adkhtmat = -1 if P_V392 == 1
replace p_womensrights1adkhtmat = . if P_V392 == 8 //dk
replace p_womensrights1adkhtmat = . if P_V392 == 0 //htmat
replace p_womensrights1adkhtmat = . if P_V392 == 9
replace p_womensrights1adkhtmat = 0 if V5254 == 4
replace p_womensrights1adkhtmat = 1 if V5254 == 7
replace p_womensrights1adkhtmat = 1 if V5254 == 5
replace p_womensrights1adkhtmat = 1 if V5254 == 6
replace p_womensrights1adkhtmat = -1 if V5254 == 1
replace p_womensrights1adkhtmat = -1 if V5254 == 2
replace p_womensrights1adkhtmat = -1 if V5254 == 3
replace p_womensrights1adkhtmat = . if V5254 == 96 //htmat
replace p_womensrights1adkhtmat = . if V5254 == 98 //dk
replace p_womensrights1adkhtmat = . if V5254 == 99

gen p_busing2adkhtmat = .
replace p_busing2adkhtmat = -1 if P_V417 == 1
replace p_busing2adkhtmat = 0 if P_V417 == 3
replace p_busing2adkhtmat = . if P_V417 == 0 //htmat
replace p_busing2adkhtmat = . if P_V417 == 8 //dk
replace p_busing2adkhtmat = 1 if P_V417 == 5
replace p_busing2adkhtmat = -1 if V5314 == 1
replace p_busing2adkhtmat = 0 if V5314 == 2
replace p_busing2adkhtmat = 0 if V5314 == 3
replace p_busing2adkhtmat = 1 if V5314 == 4
replace p_busing2adkhtmat = 1 if V5314 == 5
replace p_busing2adkhtmat = . if V5314 == 7
replace p_busing2adkhtmat = . if V5314 == 8 // dk
replace p_busing2adkhtmat = . if V5314 == 9
replace p_busing2adkhtmat = . if V5313 == 5 //htmat
replace p_busing2adkhtmat = . if V5313 == 9

gen p_libconsnewadkhtmat = .
replace p_libconsnewadkhtmat = 1 if V5300 == 5
replace p_libconsnewadkhtmat = 1 if V5300 == 6
replace p_libconsnewadkhtmat = 1 if V5300 == 7
replace p_libconsnewadkhtmat = -1 if V5300 == 1
replace p_libconsnewadkhtmat = -1 if V5300 == 2
replace p_libconsnewadkhtmat = -1 if V5300 == 3
replace p_libconsnewadkhtmat = 0 if V5300 == 4
replace p_libconsnewadkhtmat = . if V5300 == 96
replace p_libconsnewadkhtmat = 1 if P_V408 == 5
replace p_libconsnewadkhtmat = 1 if P_V408 == 6
replace p_libconsnewadkhtmat = 1 if P_V408 == 7
replace p_libconsnewadkhtmat = -1 if P_V408 == 1
replace p_libconsnewadkhtmat = -1 if P_V408 == 2
replace p_libconsnewadkhtmat = -1 if P_V408 == 3
replace p_libconsnewadkhtmat = 0 if P_V408 == 4
replace p_libconsnewadkhtmat = 0 if P_V408 == 0
replace p_libconsnewadkhtmat = . if P_V408 == 9
replace p_libconsnewadkhtmat = . if P_V408 == 8 //dk

gen p_stdlivingnewadkhtmat = .
replace p_stdlivingnewadkhtmat = 1 if V5250 == 5
replace p_stdlivingnewadkhtmat = 1 if V5250 == 6
replace p_stdlivingnewadkhtmat = 1 if V5250 == 7
replace p_stdlivingnewadkhtmat = -1 if V5250 == 1
replace p_stdlivingnewadkhtmat = -1 if V5250 == 2
replace p_stdlivingnewadkhtmat = -1 if V5250 == 3
replace p_stdlivingnewadkhtmat = 0 if V5250 == 4
replace p_stdlivingnewadkhtmat = . if V5250 == 96 //htmat
replace p_stdlivingnewadkhtmat = 1 if P_V356 == 5
replace p_stdlivingnewadkhtmat = 1 if P_V356 == 6
replace p_stdlivingnewadkhtmat = 1 if P_V356 == 7
replace p_stdlivingnewadkhtmat = -1 if P_V356 == 1
replace p_stdlivingnewadkhtmat = -1 if P_V356 == 2
replace p_stdlivingnewadkhtmat = -1 if P_V356 == 3
replace p_stdlivingnewadkhtmat = 0 if P_V356 == 4
replace p_stdlivingnewadkhtmat = . if P_V356 == 0 //htmat
replace p_stdlivingnewadkhtmat = . if P_V356 == 9
replace p_stdlivingnewadkhtmat = . if P_V356 == 8 //dk


gen p_marijuanaadkhtmat = .
replace p_marijuanaadkhtmat = 1 if P_V379 == 7
replace p_marijuanaadkhtmat = 1 if P_V379 == 6
replace p_marijuanaadkhtmat = 1 if P_V379 == 5
replace p_marijuanaadkhtmat = 0 if P_V379 == 4
replace p_marijuanaadkhtmat = -1 if P_V379 == 3
replace p_marijuanaadkhtmat = -1 if P_V379 == 2
replace p_marijuanaadkhtmat = -1 if P_V379 == 1
replace p_marijuanaadkhtmat = . if P_V379 == 0 //htmat
replace p_marijuanaadkhtmat = . if P_V379 == 8
replace p_marijuanaadkhtmat = . if P_V379 == 9
replace p_marijuanaadkhtmat = 1 if V5253 == 7
replace p_marijuanaadkhtmat = 1 if V5253 == 6
replace p_marijuanaadkhtmat = 1 if V5253 == 5
replace p_marijuanaadkhtmat = 0 if V5253 == 4
replace p_marijuanaadkhtmat = -1 if V5253 == 3
replace p_marijuanaadkhtmat = -1 if V5253 == 2
replace p_marijuanaadkhtmat = -1 if V5253 == 1
replace p_marijuanaadkhtmat = . if V5253 == 96 //htmat
replace p_marijuanaadkhtmat = . if V5253 == 98 //dk

gen p_aidminoradkhtmat = .
replace p_aidminoradkhtmat = 1 if V5252 == 5
replace p_aidminoradkhtmat = 1 if V5252 == 6
replace p_aidminoradkhtmat = 1 if V5252 == 7
replace p_aidminoradkhtmat = 0 if V5252 == 4
replace p_aidminoradkhtmat = -1 if V5252 == 1
replace p_aidminoradkhtmat = -1 if V5252 == 2
replace p_aidminoradkhtmat = -1 if V5252 == 3
replace p_aidminoradkhtmat = . if V5252 == 98 //dk
replace p_aidminoradkhtmat = . if V5252 == 96 //htmat
replace p_aidminoradkhtmat = 1 if P_V371 == 5
replace p_aidminoradkhtmat = 1 if P_V371 == 6
replace p_aidminoradkhtmat = 1 if P_V371 == 7
replace p_aidminoradkhtmat = -1 if P_V371 == 1
replace p_aidminoradkhtmat = -1 if P_V371 == 2
replace p_aidminoradkhtmat = -1 if P_V371 == 3
replace p_aidminoradkhtmat = 0 if P_V371 == 4
replace p_aidminoradkhtmat = . if P_V371 == 8 //dk
replace p_aidminoradkhtmat = . if P_V371 == 0 //htmat
replace p_aidminoradkhtmat = . if P_V371 == 9

//DK Constraint Scale
gen noSPdk = (p_libconsnewadk + p_aidminoradk + p_stdlivingnewadk + p_busing2adk + p_rightsaccused1adk + p_marijuanaadk + p_womensrights1adk)
gen noSPconstraintdk = abs(noSPdk)

foreach v of var noSPconstraintdk { 
su `v', meanonly 
gen new_`v' = (`v' - r(min))/(r(max) - r(min))

}
rename new_noSPconstraintdk noSPconstraintdk_01


//DKHTMAT Constraint Scale
gen noSPdkhtmat = (p_libconsnewadkhtmat + p_aidminoradkhtmat + p_stdlivingnewadkhtmat + p_busing2adkhtmat + p_rightsaccused1adkhtmat + p_marijuanaadkhtmat + p_womensrights1adkhtmat)
gen noSPconstraintdkhtmat = abs(noSPdkhtmat)

foreach v of var noSPconstraintdkhtmat { 
su `v', meanonly 
gen new_`v' = (`v' - r(min))/(r(max) - r(min))

}
rename new_noSPconstraintdkhtmat noSPconstraintdkhtmat_01

//Hypothesis 1
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
xtmixed cissue c.pissue##c.noSPconstraintdk_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
xtmixed cissue c.pissue##c.noSPconstraintdkhtmat_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle

//Issue
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
xtmixed cissue c.pissue##c.noSPconstraintdk_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
xtmixed cissue c.pissue##c.noSPconstraintdkhtmat_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle

//Hypothesis 2
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
xtmixed cissue c.pissue##c.noSPconstraintdk_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
xtmixed cissue c.pissue##c.noSPconstraintdkhtmat_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle

//Issue
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
xtmixed cissue c.pissue##c.noSPconstraintdk_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
xtmixed cissue c.pissue##c.noSPconstraintdkhtmat_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle

*Appendix G
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 c.pissue##c.p_knowledge_01 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
eststo knowledgeh1pid

xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 c.pissue##c.p_knowledge_01 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
eststo knowledgeh1iss

xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 c.pissue##c.p_knowledge_01 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
eststo knowledgeh2pid

xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 c.pissue##c.p_knowledge_01 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
eststo knowledgeh2iss

esttab h1pidall knowledgeh1pid h1issall knowledgeh1iss using appendixGH1.rtf, label title(Hypothesis 1 - Comparing Regression with and without Knowledge Control) mtitles("PID w/ Knowledge" "PID" "Issue Attitudes w/ Knowledge" "Issue Attitudes") se(3) ar2 b(3)
esttab knowledgeh2pid h2pidall knowledgeh2iss h2issall using appendixGH2.rtf, label title(Hypothesis 2 - Comparing Regression with and without Knowledge Control) mtitles("PID w/ Knowledge" "PID" "Issue Attitudes w/ Knowledge" "Issue Attitudes") se(3) ar2 b(3)

*Appendix H
//Switched to a different scheme here but can't remember which
//Hainmueller, Mummolo, and Xu linearity check and rugplots over marginsplot
//Creating bins of noSPconstraint_01
xtile bin5 = noSPconstraint_01, nq(5)

twoway (sc cissue pissue) (lowess cissue pissue) (lfit cissue pissue) if _j==2, by(bin5) saving(APH_Figure1.gph)
twoway (sc cissue pissue) (lowess cissue pissue) (lfit cissue pissue) if issue>0, by(bin5) saving(APG_Figure2.gph)
//Opt for 5 bins because allows for more nuanced look.


twoway (sc pissue noSPconstraint_01) (lowess pissue noSPconstraint_01) (lfit pissue noSPconstraint_01) if _j==2, title(Scatter of Parent PID and Parent Constraint) saving(APH_1PPIDPCON.gph)
twoway (sc noSPconstraint_01 pissue) (lowess noSPconstraint_01 pissue) (lfit noSPconstraint_01 pissue) if _j==2, title(Scatter of Parent Constraint and Parent PID) saving(APH_1CONPPID.gph)
twoway (sc pissue noSPconstraint_01) (lowess pissue noSPconstraint_01) (lfit pissue noSPconstraint_01) if issue>0, title(Scatter of Parent Attitudes and Parent Constraint) saving(APH1_PISSPCON.gp)
twoway (sc noSPconstraint_01 pissue) (lowess noSPconstraint_01 pissue) (lfit noSPconstraint_01 pissue) if issue>0, title(Scatter of Parent Constraint and Parent Attitudes) saving(APH_PCONPISS.gph)
//Generally linearity seems to apply all around

twoway (sc jsbpscaled1 noSPconstraint_01) (lowess jsbpscaled1 noSPconstraint_01) (lfit jsbpscaled1 noSPconstraint_01), ylabel(0 "Low" 1 "High") xlabel(0 "Low" 1 "High") ytitle("Household Politicization") title(Scatter of Household Politicization and Parent Constraint) saving(APH_PPOL_PCONS.gph)
twoway (sc noSPconstraint_01 jsbpscaled1) (lowess noSPconstraint_01 jsbpscaled1) (lfit noSPconstraint_01 jsbpscaled1), ylabel(0 "Low" 1 "High") xlabel(0 "Low" 1 "High") ytitle("Parent Constraint") xtitle("Household Politicization") title(Scatter of Parent Constraint and Household Politicization) saving(APH_PCONS_PPOL.gph)

twoway (sc pissue jsbpscaled1) (lowess pissue jsbpscaled1) (lfit pissue jsbpscaled1) if _j==2, xtitle("Household Politicization") ytitle("Parent PID") xlabel(0 "Low" 1 "High") ylabel(0 "S. Dem" 1 "S. Rep") title(Scatter of Parent PID and Household Politicization) saving(APH_PPIDPPOL.gph)
twoway (sc jsbpscaled1 pissue) (lowess jsbpscaled1 pissue) (lfit jsbpscaled1 pissue) if _j==2, ytitle("Household Politicization") xtitle("Parent PID") ylabel(0 "Low" 1 "High") xlabel(0 "S. Dem" 1 "S. Rep") title(Scatter of Household Politicization and Parent PID) saving(APH_PPOLPPID.gph)
twoway (sc pissue jsbpscaled1) (lowess pissue jsbpscaled1) (lfit pissue jsbpscaled1) if issue>0, ytitle("Parent Attitudes") ylabel(0 "Lib." 1 "Cons.") xtitle("Household Politicization") xlabel(0 "Low" 1 "High") title(Scatter of Parent Attitudes and Household Politicization) saving(PPOLPISS.gph)
twoway (sc jsbpscaled1 pissue) (lowess jsbpscaled1 pissue) (lfit jsbpscaled1 pissue) if issue>0, xtitle("Parent Attitudes") xlabel(0 "Lib." 1 "Cons.") ytitle("Household Politicization") ylabel(0 "Low" 1 "High") title(Scatter of Household Politicization and Parent Attitudes) saving(APH_PISSPPOL.gph)
//Generally linearity seems to apply all around

//Combining the graphs (Figure numbers ended up changing because rearranged):
//PISSUE AND CISSUE by quintiles - maybe just keep as separate graphs

grc1leg "APH_1PPIDPCON.gph" "APH_1CONPPID.gph", rows(1) ycommon commonscheme title("Scatter of Parent Partisanship and Parent Ideological Constraint") saving(APH_Figure3.gph, replace)

grc1leg "APH1_PISSPCON.gph" "APH_PCONPISS.gph", rows(1) ycommon commonscheme title("Scatter of Parent Issue Attitudes and Parent Ideological Constraint") saving(APH_Figure4.gph, replace)

grc1leg "APH_PPOL_PCONS.gph" "APH_PCONS_PPOL.gph", rows(1) ycommon commonscheme title("Scatters of Household Politicization and Parent Ideological Constraint") saving(APH_Figure8.gph, replace)

grc1leg "APH_PPIDPPOL.gph" "APH_PPOLPPID.gph", rows(1) ycommon commonscheme title("Scatters of Household Politicization and Parent Partisanship") saving(APH_Figure9.gph, replace)

grc1leg "PPOLPISS.gph" "APH_PISSPPOL.gph", rows(1) ycommon commonscheme title("Scatters of Household Politicization and Parent Issue Attitudes") saving(APH_Figure10.gph, replace)


//Recreating marginsplots with rugplot underneath
////Hypothesis 1////
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") addplot(hist noSPconstraint_01 if _j==2, blcolor(gs10) fcolor(gs10) percent yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 " " 50 " " 60 " " 70 " " 80 " " 90 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small))) aspectratio(1) saving(APH_AllGens_H1_PID.gph, replace)

//Issue Attitudes
xtmixed cissue c.pissue##c.noSPconstraint_01 c.pissue##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
eststo h1issall
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") addplot(hist noSPconstraint_01 if issue>0, blcolor(gs10) fcolor(gs10) percent yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 " " 50 " " 60 " " 70 " " 80 " " 90 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small))) aspectratio(1) saving(APH_AllGens_H1_Iss.gph, replace)

grc1leg "APH_AllGens_H1_PID.gph" "APH_AllGens_H1_Iss.gph", rows(1) ycommon commonscheme title("Estimated Effects of Parent's Political Views on Child's") subtitle("As Moderated by Parental Ideological Constraint") saving(APH_Allgens_H1_Figure2.gph, replace)


////HYPOTHESIS 2////
//PID
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: if _j==2, mle
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p90)jsbpscaled1) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") addplot(hist noSPconstraint_01 if _j==2, blcolor(gs10) fcolor(gs10) percent yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 " " 50 " " 60 " " 70 " " 80 " " 90 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small))) saving(APH_AllGens_H2HP_PID.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p10)jsbpscaled1) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Partisanship") xtitle("Parent Constraint")  yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") addplot(hist noSPconstraint_01 if _j==2, blcolor(gs10) fcolor(gs10) percent yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 " " 50 " " 60 " " 70 " " 80 " " 90 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small)))  saving(APH_AllGens_H2LP_PID.gph, replace)

//Issue Attitudes
xtmixed cissue c.pissue##c.noSPconstraint_01##c.jsbpscaled1 i.p_college c.parent_familyincome i.male child_clubactivity01 i.control_race i._j i.p_1965newspapermag i.p_fathermotherworkingmother i.c_attendancesimple i.p_65maritalstatuscat || region: || V7: || V5002: || indicator: || V7002: if issue>0, mle
margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p90)jsbpscaled) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") addplot(hist noSPconstraint_01 if issue>0, blcolor(gs10) fcolor(gs10) percent yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 " " 50 " " 60 " " 70 " " 80 " " 90 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small))) saving(APH_AllGens_H2HP_Iss.gph, replace)

margins, dydx(pissue) at(noSPconstraint_01=(0 .2 .4 .6 .8 1)(p10)jsbpscaled) asobserved
marginsplot, recastci(rline) plotopts(msymbol(i)) yline(0, lcolor(grey12)lpattern(longdash)) ytitle("Estimated Effect") title("Issue Attitudes") xtitle("Parent Constraint") yscale(range(-.5 1)) ylabel(-.5(.5)1, noticks) xlabel(0 "Low" 1 "High") addplot(hist noSPconstraint_01 if issue>0, blcolor(gs10) fcolor(gs10) percent yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 " " 50 " " 60 " " 70 " " 80 " " 90 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small))) saving(APH_AllGens_H2LP_Iss.gph, replace)

grc1leg "APH_AllGens_H2LP_PID.gph" "APH_AllGens_H2LP_Iss.gph", rows(1) ycommon commonscheme title("Low Politicization Households") saving(APH_Allgens_H2LP_Figure3.gph, replace)

grc1leg "APH_AllGens_H2HP_PID.gph" "APH_AllGens_H2HP_Iss.gph", rows(1) ycommon commonscheme title("High Politicization Households") saving(APH_Allgens_H2HP_Figure3.gph, replace)

grc1leg "APH_Allgens_H2HP_Figure3.gph" "APH_Allgens_H2LP_Figure3.gph", col(1) ycommon commonscheme title("Estimated Effects of Parent's Political Views on Child's") subtitle("As Moderated by Parental Ideological Constraint and Household Politicization") xsize(1) ysize(1.25) saving(APH_Allgens_H2_Figure3.gph, replace)
